import request from '@/utils/request'

// 查询商品信息列表
export function listGoods(query) {
  return request({
    url: '/system/goodsPresale/list',
    method: 'get',
    params: query
  })
}
// 查询库存低于30商品信息列表
export function listLittleGoods(query) {
  return request({
    url: '/system/goodsPresale/listLittleGoods',
    method: 'get',
    params: query
  })
}


// 查询商品信息详细
export function getGoods(goodsId) {
  return request({
    url: '/system/goodsPresale/' + goodsId,
    method: 'get'
  })
}

// 新增商品信息
export function addGoods(data) {
  return request({
    url: '/system/goodsPresale/add',
    method: 'post',
    data: data
  })
}

// 普通转预售
export function transformnNormalGoods(data) {
  return request({
    url: '/system/goodsPresale/transformnNormal',
    method: 'post',
    data: data
  })
}



// 修改商品信息
export function updateGoods(data) {
  return request({
    url: '/system/goodsPresale/edit',
    method: 'put',
    data: data
  })
}

// 删除商品信息
export function delGoods(goodsId) {
  return request({
    url: '/system/goodsPresale/delete/' + goodsId,
    method: 'delete'
  })
}

export function changeState(data) {
  return request({
    url: '/system/goodsPresale/changeState',
    method: 'post',
    data: data
  })
}




export function getKeepGoods(goodsId) {
  return request({
    url: '/system/goods/keep/' + goodsId,
    method: 'get'
  })
}
// 导出商品信息
export function exportGoods(query) {
  return request({
    url: '/system/goods/export',
    method: 'get',
    params: query
  })
}



// 购物车预售商品记录
export function presaleCarts(query) {
  return request({
    url: '/system/goodsPresale/presaleCarts',
    method: 'get',
    params: query
  })
}